﻿#define _CRT_SECURE_NO_WARNINGS 1

// 1.小红的口罩
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int N = 1e5 + 10;
int n, k, tmp;
int a[N];
priority_queue<int, vector<int>, greater<>> q;
int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> tmp;
		q.push(tmp);
	}
	int sum = 0;
	int cnt = 0;
	while (q.size())
	{
		int a = q.top();
		q.pop();
		sum += a;
		if (sum <= k)
			cnt++;
		else
			break;
		q.push(a * 2);
	}
	cout << cnt << endl;
	return 0;
}

// 2.春游
#include <iostream>
using namespace std;
typedef long long LL;
LL t;
LL n, a, b;
LL fun()
{
	// 边界情况
	if (n <= 2) 
		return min(a, b);

	LL ret = 0;
	if (a * 3 < b * 2) // 尽可能的选择双⼈船
	{
		ret += n / 2 * a;
		n %= 2;
		if (n) ret += min(min(a, b), b - a);
	}
	else // 尽可能的选择三⼈船
	{
		ret += n / 3 * b;
		n %= 3;
		if (n == 1) ret += min(min(a, b), 2 * a - b);
		if (n == 2) ret += min(min(a, b), 3 * a - b);
	}
	return ret;
}
int main()
{
	cin >> t;
	while (t--)
	{
		cin >> n >> a >> b;
		cout << fun() << endl;
	}

	return 0;
}

// 3.数位染色
#include <iostream>
using namespace std;
int a[20];
bool dp[20][180];
int main() {
	string s;
	cin >> s;

	int n = s.size();
	for (int i = 0; i < n; ++i)
		a[i + 1] = s[i] - '0';

	// 求和
	int sum = 0;
	for (int i = 1; i <= n; ++i)
		sum += a[i];

	// 特殊情况
	if (sum % 2 != 0)
		cout << "No" << endl;
	else
	{
		int mid = sum / 2;
		for (int i = 0; i <= n; ++i)
			dp[i][0] = true;
		for (int i = 1; i <= n; ++i)
		{
			for (int j = 1; j <= mid; ++j)
			{
				dp[i][j] = dp[i - 1][j];
				if (j >= a[i])
					dp[i][j] = dp[i - 1][j] || dp[i - 1][j - a[i]];
			}
		}
		if (dp[n][mid])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}